package com.hnevc.jdbcdao;

import java.sql.ResultSet;
import java.sql.SQLException;

public class DBDemo {

	public static void main(String[] args) {
		DBUtils db = new DBUtils();
		try {
			db.getConnection();
			ResultSet rs = db.executeQuery("select * from users", null);
			int columnCount = rs.getMetaData().getColumnCount();
			for(int i=1;i<= columnCount;i++){
				System.out.print(rs.getMetaData().getColumnName(i)+"\t\t");
			}
			System.out.println();
			while(rs.next()){
				for(int i=1;i<=columnCount;i++){
					System.out.print(rs.getString(i) +"\t\t");
				}
				System.out.println();
			}
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}	
	}
}
